<?php
/**[栏目试图模型]
 * @Author: 976123967@qq.com
 * @Date:   2014-11-11 13:05:26
 * @Last Modified by:   Administrator
 * @Last Modified time: 2014-11-11 13:19:11
 */
class CategoryViewModel extends ViewModel{

	protected $tableName='category';


	public $viewFields  = array(
		'category'=>array(

			'_type'=>'INNER',
		),
		'type'=>array(
			'*',
			'_type'=>'INNER',
			'_on' =>'category.type_typeid=type.typeid',
		),
		'attr'=>array(
		
			'_type'=>'INNER',
			'_on' =>'type.typeid=attr.type_typeid',
		),

	);


	/**
	 * [get_count 统计分类下面的属性]
	 * @param  [type] $cid [description]
	 * @return [type]      [description]
	 */
	public function get_count($cid)
	{

		$where['cid'] = $cid ;
		return $this->where($where)->count();
	}

}